//
//  ResourceData.hpp
//  smu_test1
//
//  Created by jiayi on 16/9/25.
//  Used to define basic structures
//

#ifndef smuNode_hpp
#define smuNode_hpp

// smart pointer define
struct smuNode;

typedef std::list<smuNode*> smuNodes;
typedef smuNodes::iterator smuNodesIter;
typedef smuNodes::const_iterator smuNodesConstIter;

// resource structure
struct smuNode{
    
    // name of the resource
    std::string name;
    
    // resoures to rely on
    smuNodes relyTo;
    
    // resources reply on this
    smuNodes relyFrom;
    
    // ctor
    smuNode() : usable( true ), deleted( false ){}
    
    // set/get usable
    void setUsable( bool b ){ usable = b ;}
    bool isUsable() const { return usable; }
    
    // set/get deleted
    void setDeleted( bool b ){ deleted = b; usable = b ? false : usable; }
    bool isDeleted() const { return deleted; }
    
    bool isAvailable() const { return usable && !deleted; }
    
private:
    
    // is usable
    bool usable;
    
    // is deleted
    bool deleted;

};


#endif /* smuNode_hpp */
